{__NOLAYOUT__}
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
	<title></title>
	{include file="public/script" /}
</head>
<body>
	<div class="sectionH sectionH2 mui-clearfix">
		<header class="mui-bar mui-bar-nav" style="">
			<a class="mui-icon mui-icon-left-nav  mui-pull-left" href="javascript:history.back(-1)" style="color: #727272;"></a>
			<h1 class="mui-title">私信</h1>
			<!--<a class="mui-icon mui-pull-right right1" href="javascript:;" style="padding-top: 10px;"><img src="images/nav_icon_search.png"/></a>-->
		</header>
	</div>
	<div class="kong1"></div>
	<div class="sixin_section1" style="position: absolute;z-index: 2;width: 100%;height: 93%;">
		<div class="container" style="position: absolute;width: 100%;z-index: 1;">
			<div class="items"style="position: relative;">
				{volist name="list" id="item"}
				<a href="{:url('Chat/message',['getid'=>$item.talk_manid])}">
					<div class="items_1 mui-clearfix">
						<div class="div1">
							<img src="{$item.headimg|default='/static/default_avatar.png'}" alt="" />
						</div>
						<div class="div2">
							<p class="p1">
								<span class="s1">{$item.username}</span>
								{if condition="$item.bussiness != ''"}
								<span class="s2">{$item.bussiness}</span>
								{/if}
							</p>
							<p class="p2">{$item.tip}</p>
						</div>
						<div class="div3" style="width: 14%;">
							<p class="p1">{if condition="$item.noreadernum gt 0"}<span class="s1">{$item.noreadernum}</span>{/if}</p>
							<p class="plyq">{$item.ctime}</p>
						</div>
					</div>
				</a>
				{/volist}
			</div>
		</div>
	</div>
</body>
<script>
    mui.init({
        pullRefresh: {
            container: '.sixin_section1',
            down: {

            },
            up: {
                auto:false,
                contentrefresh: '正在加载...',
                callback: pullupRefresh
            }
        }

    });

    var count = 1;
    var finish = false;
    function pullupRefresh() {
        setTimeout(function() {
            ++count;

            $.ajax({
                type: "POST",
                url: "{:url('Chat/talkList')}",
                data: {page:count},
                dataType: "json",
                success: function(data){
                    if(data.result_code==='0000'){
                        var list = data.result_data.list;
                        //console.log(list);
                        if(list.length===0){
                            finish=true;
                        }
                        mui('.sixin_section1').pullRefresh().endPullupToRefresh((finish)); //参数为true代表没有更多数据了。
                        var table = document.body.querySelector('.items');
                        if(list.length>0){
                            for(var i=0;i<list.length;i++){
								var url = '/Chat/message/getid/'+list[i]['talk_manid'];
								if(list[i]['headimg']==''){
									var headimg = '/static/default_avatar.png';
								}else{
                                    var headimg = list[i]['headimg'];
								}

								if(list[i]['bussiness']==''){
									var tag1 = '';
								}else{
								    var tag1 = '<span class="s2">'+list[i]['bussiness']+'</span>';
                                }

                                if(list[i]['noreadernum'] > 0){
                                	var tag2 = '<span class="s1">'+list[i]['noreadernum']+'</span>';
								}else{
									var tag2 = '';
								}

                                var html = 	'<div class="items_1 mui-clearfix">'+
                                    				'<div class="div1">'+
                                    					'<img src="'+headimg+'" alt="" />'+
                                    				'</div>'+
                                    				'<div class="div2">'+
                                    					'<p class="p1">'+
                                    						'<span class="s1">'+list[i]['username']+'</span>'+tag1+

                            							'</p>'+
                                						'<p class="p2">'+list[i]['tip']+'</p>'+
                                					'</div>'+
                                					'<div class="div3" style="width: 14%;">'+
                                    					'<p class="p1">'+tag2+'</p>'+
                                						'<p class="plyq">'+list[i]['ctime']+'</p>'+
                                					'</div>'+
												'</div>';


                                var a = document.createElement('a');
                                a.href=url;
                                a.innerHTML = html;
                                table.appendChild(a);
                            }
                        }
                    }else if(data.result_code==='1111'){
                        mui.alert('请登录','',function(){
                            window.location.href='/Login/login';
                        });
                    }else{
                        mui.alert(data.result_info);
                    }

                }
            });
        }, 500);
    }
</script>
</html>